/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.suli.roll.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author WYH
* @date 2024-03-14
**/
@Entity
@Data
@Table(name="roll")
public class Roll implements Serializable {

    @Id
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private String id;

    @Column(name = "`roll_code`")
    @ApiModelProperty(value = "转仓单号")
    private String rollCode;

    @Column(name = "`from_wano`")
    @ApiModelProperty(value = "从库区")
    private String fromWano;

    @Column(name = "`to_wano`")
    @ApiModelProperty(value = "至库区")
    private String toWano;

    @Column(name = "`mr_qty`")
    @ApiModelProperty(value = "数量")
    private BigDecimal mrQty;

    @Column(name = "`type`")
    @ApiModelProperty(value = "类型")
    private String type;

    @Column(name = "`status`")
    @ApiModelProperty(value = "状态")
    private String status;

    @Column(name = "`create_time`")
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "`create_by`")
    @ApiModelProperty(value = "创建人")
    private String createBy;

    @Column(name = "`update_time`")
    @ApiModelProperty(value = "修改时间")
    private Timestamp updateTime;

    @Column(name = "`source_document`")
    @ApiModelProperty(value = "来源单据")
    private String sourceDocument;

    @Column(name = "`remk`")
    @ApiModelProperty(value = "备注")
    private String remk;

    public void copy(Roll source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
